package com.ds.controller.restful;

import java.util.Map;

import com.ds.orm.model.BlogClassify;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import org.springframework.http.MediaType;

import com.ds.core.util.WebUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import com.ds.core.base.BaseController;

/**
 * <p>
 * 用户自定义的博客分类  前端控制器
 * </p>
 *
 * @author Du
 * @since 2017-11-28
 */
@RestController
@RequestMapping("/blogClassify")
@Api(value = "用户自定义的博客分类接口", description = "用户自定义的博客分类接口")
public class BlogClassifyController extends BaseController<BlogClassify> {
	public String getService() {
		return "blogClassifyService";
	}

	@RequiresPermissions("blogClassify.read")
	@PutMapping(value = "/read/list")
	@ApiOperation(value = "查询用户自定义的博客分类", produces = MediaType.APPLICATION_JSON_VALUE)
	public Object query(HttpServletRequest request) {
		Map<String, Object> param = WebUtil.getParameter(request);
        ModelMap modelMap = new ModelMap();
		return super.query(modelMap, param);
	}

	@RequiresPermissions("blogClassify.read")
	@PutMapping(value = "/read/detail")
	@ApiOperation(value = "用户自定义的博客分类详情", produces = MediaType.APPLICATION_JSON_VALUE)
	public Object get(HttpServletRequest request) {
		BlogClassify param = WebUtil.getParameter(request, BlogClassify.class);
        ModelMap modelMap = new ModelMap();
		return super.get(modelMap, param);
	}

	@PostMapping
	@RequiresPermissions("blogClassify.update")
	@ApiOperation(value = "修改用户自定义的博客分类", produces = MediaType.APPLICATION_JSON_VALUE)
	public Object update(HttpServletRequest request) {
		BlogClassify param = WebUtil.getParameter(request, BlogClassify.class);
        ModelMap modelMap = new ModelMap();
		return super.update(modelMap, param);
	}

	@DeleteMapping
	@RequiresPermissions("blogClassify.delete")
	@ApiOperation(value = "删除用户自定义的博客分类", produces = MediaType.APPLICATION_JSON_VALUE)
	public Object delete(HttpServletRequest request) {
		BlogClassify param = WebUtil.getParameter(request, BlogClassify.class);
        ModelMap modelMap = new ModelMap();
		return super.delete(modelMap, param);
	}
}
